forked from mozilla/pdf.js
-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] Allow custom search for pdf.js embedder #2
Draft
nicolo-ribaudo
wants to merge
210
commits into
master
Choose a base branch
from
wip-custom-find-matcher
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a major version bump, but the changelog at https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v54.0.0 doesn't indicate any breaking changes that should impact us.
…fied-legacy builds (issue 18290)
[Editor] Remove the various listeners when destroying the editor manager
This has two advantages, as far as I'm concerned: - The tests don't need to manually invoke multiple functions to properly clean-up, which reduces the risk of missing something. - By collecting all the relevant clean-up in one method, rather than spreading it out, we get a much better overview of exactly what is being reset.
Update dependencies to the most recent versions and upgrade `eslint-plugin-unicorn` to version 54.0.0
…t-improve-regex Update the regular expression in `tweakWebpackOutput` to support minified-legacy builds (issue 18290)
This commit introduces a test to ensure that: - When zooming below the maxCanvasPixels limit, the canvas is rendered with the correct size (the two sides are multiplied by the zoom factor). - When zooming above the maxCanvasPixels limit, the canvas size is capped.
Ensure that we never round the canvas dimensions above `maxCanvasPixels` by rounding them to the preceeding multiple of the display ratio rather than the succeeding one.
Add a new helper, in the viewer, to close everything during testing
…xels Respect `maxCanvasPixels` when computing canvas dimensions
…viewer has been closed
By closing `PDFFindBar` we also disconnect the `ResizeObserver`, since we've seen at least one case where that's running during shutdown: http://54.193.163.58:8877/91c40554d1b07c0/output.txt
…eam` (issue 18298) Following in the footsteps of PR 17340.
[Editor] Don't create an observer for the stamp annotation after the viewer has been closed
…a stamp with an alt text (bug 1903589)
Don't throw if there's not enough data to get the header in `FlateStream` (issue 18298)
[Editor] Correctly set the accessibility data when copying & pasting a stamp with an alt text (bug 1903589)
…bar-close Close `PDFFindBar` when closing the viewer during testing
Always use DW if it's a number for the font default width (bug 1903731)
Allow apps with supportsIntegratedFind to better monitor the find state. A recognized use case is the Firefox findbar, its "not found" sound must consider `entireWord` and only make noise when it is off. See related implementation in https://hg.mozilla.org/mozilla-central/rev/16b902cbcf26 This change can help if we have to move the implementation from cpp to jsm.
Use the new formatted issue templates
Expose entireWord in updateFindControlState
Even with PR 18280 fixed, we still *occasionally* see l10n-related errors when closing the integration-tests on the bots.
Update dependencies and translations to the most recent versions
After the changes in PR 18413 we're now relying even more on `AppOptions` and it thus seems like a good idea to ensure that no invalid values can be added. Hence the `AppOptions.{set, setAll}` methods will now *unconditionally* validate that the type of the values agree with the default-options.
This was only necessary to prevent (unlikely) visual glitches when `disableAutoFetch = true` is being used. However, it turns out that we can move this functionality into the `ProgressBar` class instead by checking if the entire PDF document has loaded. This works since the API is always reporting 100% loading progress regardless of how the document was loaded; see [this code](https://github.com/mozilla/pdf.js/blob/ed83d7c5e16798a56c493d56aaa8200dd280bb17/src/display/api.js#L2735-L2740).
The old implementation in `PDFViewerApplication.download` means that if the `getDocument`-call hasn't yet downloaded the *entire* PDF document it will be re-downloaded. This seems generally undesirable since: - In some (probably rare) cases a URL may not be valid an arbitrary number of times, which means that the download may fail. - It will lead to wasted resources, since we'll end up fetching the same PDF document *twice* in that case (once via the `getDocument`-call and once to allow the user to save it). Hence this patch suggests that we change this very old code to instead always call the `PDFDocumentProxy.getData` method, since that'll trigger immediate downloading of the remaining document via the existing `getDocument`-call. Finally, the patch removes the `PDFViewerApplication.downloadComplete` property since it's now unused.
…ngUrl` Rather than repeating code, we can always fallback to the raw URL instead.
…url-fallback Reduce a tiny bit of duplication in `PDFViewerApplication.setTitleUsingUrl`
…mplete Re-factor the code to remove all uses of `PDFViewerApplication.downloadComplete`
…lidation Add more validation when setting `AppOptions` (PR 18413 follow-up)
This is needed for upcoming changes, and simplifies both checking if an entry exists and iteration of the entries.
This is needed for upcoming changes, and simplifies both checking if an entry exists and iteration of the entries.
Given that the entire default viewer initialization depends on the preferences being available, try to do this as early as possible.
…init Move the `Preferences` initialization as early as possible
Introduce some `Map`-usage in the AppOptions
Besides being slightly shorter, this should help reduce the risk of confusion given the very similar global Object/Map names.
To avoid introducing any inline "hacks" in the viewer-code this meant adding `useSystemFonts` to the AppOptions, which thus required some new functionality since the default value should be `undefined` given how the option is handled in the API; note [this code](https://github.com/mozilla/pdf.js/blob/ed83d7c5e16798a56c493d56aaa8200dd280bb17/src/display/api.js#L298-L301). Finally, also moves the definition of the development-mode `window.isGECKOVIEW` property to the HTML file such that it's guaranteed to be set regardless of how and when it's accessed.
Add a pref containing the url for the sumo page about alt text (bug 1909097)
Disable system fonts on Android (issue 18210)
This method has *never* been used anywhere in the code-base, so I really don't know why I added it originally.
Add the possibility to delete a model (bug 1908939)
…lid_cs Fallback on DeviceGray when a colorspace cannot be parsed
Remove the unused `AppOptions.remove` method
nicolo-ribaudo
force-pushed
the
wip-custom-find-matcher
branch
from
July 22, 2024 17:23
2e9c1ec
to
33efbed
Compare
nicolo-ribaudo
force-pushed
the
wip-custom-find-matcher
branch
2 times, most recently
from
July 23, 2024 09:34
97710cc
to
58812aa
Compare
nicolo-ribaudo
force-pushed
the
wip-custom-find-matcher
branch
from
July 24, 2024 10:37
58812aa
to
a8f7fba
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work-in-progress patch to allow pdf.js embedders to define their own search logic.
Based on review feedback in mozilla#16285 and mozilla#16428, this patch:
PDFFindController
works